package T;

public class TestDemo1 {
    public static void main(String[] args) {
        MyArrayList<String> list = new MyArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
//        list.add(1);
        String s1 = list.get(2);

        MyArrayList<Integer> list2 = new MyArrayList<>();
        MyArrayList<Boolean> list3 = new MyArrayList<>();
        System.out.println(list.getClass());
        System.out.println(list2.getClass());
        System.out.println(list3.getClass());
    }
}

class MyArrayList<E>{
    private E[] elem;
    private int usedSize;

    public MyArrayList() {
        elem = (E[])new Object[10];
    }
    public void add(E data){
        elem[usedSize] = data;
        usedSize++;
    }
    public E get(int post){
        return elem[post];
    }
}